﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Sublimation
{
    public class EnemyUnitKamikaze : EnemyUnit
    {
        new protected int NUMBER_OF_FRAMES_TO_PLAY = 8;
        new protected const int FRAMES_PER_SECOND = 20;

        public EnemyUnitKamikaze(WorldProperties worldProperties, EnemyKind kind, int spawnPoint)
            : base(worldProperties, kind, spawnPoint)
        {
            Origin = new Vector2(87, 89);
        }

        public EnemyUnitKamikaze(WorldProperties worldProperties,EnemyKind kind)
            : base(worldProperties, kind)
        {
            Origin = new Vector2(87, 89);
        }

        protected override void LoadContent()
        {
            base.LoadContent();
            Origin = new Vector2(23, 34);
            textureAnimator = new AnimatedSprite.AnimatedTexture(Origin, Rotation, Scale, 1.0f);
            textureAnimator.Load(Game.Content, "Sprites\\enemy5", NUMBER_OF_FRAMES_TO_PLAY, FRAMES_PER_SECOND);
            textureAttack = new AnimatedSprite.AnimatedTexture(Origin, Rotation, Scale, 1.0f);
            textureAttack.Load(Game.Content, "Sprites\\enemy5_attack", 5, FRAMES_PER_SECOND);
            
            Scale = 0.2f;
        }
        public override void Kill()
        {
            base.Kill();
            if (Life <= 0)
            {
                new Animation(worldProperties, this, 1.6f, 8, 12, "Sprites\\kamikaze_explode");
                new Animation(worldProperties, this, 0.6f, 4, 10, "Sprites\\enemy5_dying");
            }
        }

        protected override void collideWithTower(Tower tower, GameTime gameTime)
        {
            base.collideWithTower(tower, gameTime);
            ApplyDamage(Life);
        }
    }
}
